﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace Dye_Lib
{
    [Serializable]
    public abstract class Object : Component
    {
        internal override void SelecteerObject(Point point, int screenOffsetX, int screenOffsetY)
        {
            selected = (afmeting.X <= point.X - screenOffsetX &&
                        point.X - screenOffsetX <= afmeting.X + afmeting.Width &&
                        afmeting.Y <= point.Y - screenOffsetY &&
                        point.Y - screenOffsetY <= afmeting.Y + afmeting.Height);
        }
        internal override void VerplaatsObject(Point point)
        {
            if (selected)
            {
                afmeting.X += point.X;
                afmeting.Y += point.Y;
            }
        }
        internal override void PlaatsObject()
        {
            if (selected)
            {
                afmeting.X = ((int)Math.Round(afmeting.X / 30.0)) * 30;
                afmeting.Y = ((int)Math.Round(afmeting.Y / 30.0)) * 30;
            }
        }
    }
}
